#!/bin/bash


export PATH=/usr/bin:/bin:/usr/sbin
umask 022

if [ "X$(zonename)" != "Xglobal" ]; then
   if [ $# -ne 1 -o "X$1" != "Xmaster" -a "X$1" != "Xslave" ]; then
	echo "Usage: 
		$(basename $0) master|slave 
"
	exit 1
   fi
   servertype=$1
fi

if [ ! -x  /usr/xpg4/bin/grep ]; then 
	echo "/usr/xpg4/bin/grep is missing or not executable."
	exit 1
fi

if pkginfo -q SMCgcc 2>/dev/null; then
	if ! pkginfo -l SMCgcc | /usr/xpg4/bin/grep -q "VERSION:  3.4.6"; then 
		echo "SMCgcc 3.4.6 is required." >&2
	fi
else
	echo "SMCgcc 3.4.6 is required. Please install SMCliconv 1.11 and then SMCgcc 3.4.6" >&2; exit 1
fi

# GCC - libiconv-1.11-sol10-x86-local gcc-3.4.6-sol10-x86-local

pkginfo SUNWbindr >/dev/null 2>&1
if [ $? -ne 0 ]; then echo "Aborted - Package SUNWbindr is missing."  >&2; exit 1; fi

pkginfo SUNWbind >/dev/null  2>&1
if [ $? -eq 0 ]; then 
   if [ "X$(zonename)" == "Xglobal" ]; then
	printf "\n%-60s\n"  "Removing package SUNWbind..."
	pkgrm -n SUNWbind
   else
	echo "Error: - Package SUNWbind exists."
   fi
fi

if [ -f /lib/svc/method/dns-servers ]; then
	echo "Failure - /lib/svc/method/dns-servers is missing"
	exit 2
fi

if [ "X$(zonename)" == "Xglobal" ]; then
   printf "%-60s"  "Modifying /lib/svc/method/dns-servers..."
   change="no"
   if ! /usr/xpg4/bin/grep -q '^server="/opt/bind/sbin/named"' /lib/svc/method/dns-server; then
	sed -e "s/^server=.*/server=\"\/opt\/bind\/sbin\/named\"/" /lib/svc/method/dns-server > /tmp/$$
	cp /tmp/$$ /lib/svc/method/dns-server
	change="yes"
   fi

   if ! /usr/xpg4/bin/grep -q "^[[:space:]]*configuration_file=/etc/named/named.conf" /lib/svc/method/dns-server  2>/dev/null; then
	/usr/xpg4/bin/sed -e "s/^[[:space:]]\{1,\}configuration_file=\/etc\/named\.conf$/    configuration_file=\/etc\/named\/named.conf/" /lib/svc/method/dns-server > /tmp/$$
	cp /tmp/$$ /lib/svc/method/dns-server
	change="yes"
   fi

   if  [ $change == "yes" ]; then
	if /usr/xpg4/bin/grep  -q -e "^server=\"\/opt\/bind\/sbin\/named\"$" /lib/svc/method/dns-server && /usr/xpg4/bin/grep -q -e  "^[[:space:]]\{1,\}configuration_file=\/etc\/named\/named\.conf" /lib/svc/method/dns-server;  then
		echo "Success"
	else
		echo "Failure"
	fi                 
   else	
	echo "Skipped"
   fi


   for c in host dig nslookup; do
  	 printf "%-60s" "Creating symbolic link /usr/sbin/${c}..."
	   if [ -L /usr/sbin/${c} ]; then
		echo "Skipped"
  	 else	
		ln -s /opt/bind/bin/${c} /usr/sbin/${c}
		if [ $? -eq 0 ]; then echo "Success"; else echo "Failure"; fi
  	 fi
   done
  	 printf "%-60s" "Creating directory /opt/bind/bin..."
	 if [ -d /opt/bind/bin ]; then
		echo "Skipped"
	 else
		mkdir -p /opt/bind/bin
		if [ $? -eq 0 ]; then echo "Success"; else echo "Failure"; fi
	 fi
   exit 

else

   if /usr/xpg4/bin/grep  -q -e "^server=\"\/opt\/bind\/sbin\/named\"$" /lib/svc/method/dns-server && /usr/xpg4/bin/grep -q -e  "^[[:space:]]\{1,\}configuration_file=\/etc\/named\/named\.conf" /lib/svc/method/dns-server;  then
	echo
   else
	echo "Aborted - /lib/svc/method/dns-server is incorrect." 
	exit 1
   fi
fi

errors="no"
printf "%-60s"  "Modifying SUPATH on /etc/default/login..."
if /usr/xpg4/bin/grep -q '^SUPATH=/opt/bind/bin:/opt/bind/sbin:' /etc/default/login 2>/dev/null; then
	echo "Skipped"
else
	if /usr/xpg4/bin/grep -q '^SUPATH=' /etc/default/login 2>/dev/null; then
		sed -e 's/^SUPATH=/SUPATH=\/opt\/bind\/bin:\/opt\/bind\/sbin:/' /etc/default/login > /tmp/$$ 2>/dev/null
		if [ $? -ne 0 ]; then errors="yes"; fi
		cp /tmp/$$ /etc/default/login 2>/dev/null
		if [ $? -ne 0 -o $errors == "yes" ]; then echo "Failure"; else echo "Success"; fi
	else
		if /usr/xpg4/bin/grep -q '^#SUPATH=' /etc/default/login 2>/dev/null; then
			sed -e 's/^#SUPATH=.*/SUPATH=\/opt\/bind\/bin:\/opt\/bind\/sbin:\/usr\/sbin:\/usr\/sfw\/sbin:\/opt\/sfw\/sbin:\/usr\/bin:\/usr\/sfw\/bin:\/opt\/sfw\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/ccs\/bin:\/usr\/etc:\/usr\/ucb/' /etc/default/login > /tmp/$$ 2>/dev/null
			if [ $? -ne 0 ]; then errors="yes"; fi
			cp /tmp/$$ /etc/default/login 2>/dev/null
			if [ $? -ne 0  -o $errors == "yes" ]; then echo "Failure"; else echo "Success"; fi
		else	
			echo SUPATH=/opt/bind/bin:/opt/bind/sbin:/usr/sbin:/usr/sfw/sbin:/opt/sfw/sbin:/usr/bin:/usr/sfw/bin:/opt/sfw/bin:/usr/local/sbin:/usr/local/bin:/usr/ccs/bin:/usr/etc:/usr/ucb >> /etc/default/login
			if [ $? -ne 0 ]; then echo "Failure"; else echo "Success"; fi
		fi
	fi
fi
		
printf "%-60s" "Generating /.profile..."
/usr/xpg4/bin/grep -q "^PATH=/opt/bind/sbin:/opt/bind/bin:/usr/local/sbin:" /.profile 2>/dev/null
if [ $? -eq 0 ]; then echo "Skipped"; else 
	cat > /.profile <<MYEOF
PATH=/opt/bind/sbin:/opt/bind/bin:/usr/local/sbin:/bin:/usr/bin:/usr/sbin:/usr/ucb:/etc:/usr/ccs/bin:/usr/local/bin:/usr/sfw/bin:/opt/sfw/bin:/sbin:/usr/sfw/sbin:/opt/sfw/sbin:/usr/openwin/bin;export PATH
MANPATH=/opt/bind/share/man:/usr/man:/usr/local/man
export MANPATH
EDITOR=vi;export EDITOR
PS1="`uname -n`# ";export PS1
MYEOF
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

printf "%-60s"  "Creating user named..."
if [ "X$(id named 2>/dev/null)" ==  'Xuid=1688(named) gid=1688(named)' ]; then 
	echo "Skipped"	
else
	if ! grep "^named::1688:" /etc/group >/dev/null; then
		groupadd -g 1688 named
		if [ $? -ne 0 ]; then exit 2; fi
	fi
	SHELL="/sbin/noshell"
	if [ ! -f /sbin/noshell ]; then SHELL="/bin/false"; fi
	useradd -u 1688 -g named -m -d /var/named -s $SHELL -c BIND named # >/dev/null 2>&1
	if [ $? -eq 0 ]; then
		rm -f /var/named/.profile /var/named/local.*
		echo "Success"
	else
		echo "Failure"
		exit 2
	fi
fi

printf "%-60s" "Modifying /etc/user_attr..."
/usr/xpg4/bin/grep -q  '^named::::type=normal;defaultpriv=basic,!proc_session,!proc_info,!file_link_any,net_privaddr,file_dac_read,file_dac_search,sys_resource,proc_chroot' /etc/user_attr
if [ $? -eq 0 ]; then 
	echo "Skipped"
else 
	if /usr/xpg4/bin/grep -q  '^named:' /etc/user_attr; then
		sed -e 's/^named:.*/named::::type=normal;defaultpriv=basic,!proc_session,!proc_info,!file_link_any,net_privaddr,file_dac_read,file_dac_search,sys_resource,proc_chroot/' /etc/user_attr > /tmp/$$
		cp /tmp/$$ /etc/user_attr
		if /usr/xpg4/bin/grep -q  '^named::::type=normal;defaultpriv=basic,!proc_session,!proc_info,!file_link_any,net_privaddr,file_dac_read,file_dac_search,sys_resource,proc_chroot' /etc/user_attr; then echo Success; else Failure; fi
	else
		echo -e 'named::::type=normal;defaultpriv=basic,!proc_session,!proc_info,!file_link_any,net_privaddr,file_dac_read,file_dac_search,sys_resource,proc_chroot' >> /etc/user_attr
		if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
	fi
fi
		

if ! svcs svc:/network/dns/server:default >/dev/null 2>&1; then
	echo "SMF svc:/network/dns/server:default is missing. Aborted."; exit 2
fi

printf "%-60s"  "Modifying SMF start/user..."
svccfg -s svc:/network/dns/server:default listprop start/user 2>/dev/null | /usr/xpg4/bin/grep -q  "^start\/user[[:space:]]\{1,\}astring[[:space:]]\{1,\}named"  2>/dev/null
if [ $? -eq 0 ]; then echo "Skipped"
else 
	svccfg -s svc:/network/dns/server:default setprop start/user = astring: "named" >/dev/null 2>&1
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

printf "%-60s"  "Modifying SMF start/group..."
svccfg -s svc:/network/dns/server:default listprop start/group 2>/dev/null | /usr/xpg4/bin/grep -q  "^start\/group[[:space:]]\{1,\}astring[[:space:]]\{1,\}named"  2>/dev/null
if [ $? -eq 0 ]; then echo "Skipped"
else 
	svccfg -s svc:/network/dns/server:default setprop start/group = astring: "named" >/dev/null 2>&1
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

printf "%-60s" "Modifying SMF start/timeout_seconds..."
svccfg -s svc:/network/dns/server:default listprop start/timeout_seconds 2>/dev/null | /usr/xpg4/bin/grep -q  "^start\/timeout_seconds[[:space:]]\{1,\}count[[:space:]]\{1,\}240" 2>/dev/null
if [ $? -eq 0 ]; then echo "Skipped"
else 
	svccfg -s svc:/network/dns/server:default setprop start/timeout_seconds = count: 240 >/dev/null 2>&1
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

printf "%-60s" "Modifying SMF tm_man_named/manpath..." 
svccfg -s svc:/network/dns/server listprop tm_man_named/manpath 2>/dev/null | /usr/xpg4/bin/grep -q "^tm_man_named\/manpath[[:space:]]\{1,\}astring[[:space:]]\{1,\}\/opt\/bind\/share\/man" 2>/dev/null
if [ $? -eq 0 ]; then echo "Skipped"
else 
	svccfg -s svc:/network/dns/server setprop  tm_man_named/manpath = astring: /opt/bind/share/man >/dev/null 2>&1
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

printf "%-60s" "Modifying SMF tm_man_named/section..." 
svccfg -s svc:/network/dns/server listprop tm_man_named/section 2>/dev/null | /usr/xpg4/bin/grep -q "^tm_man_named\/section[[:space:]]\{1,\}astring[[:space:]]\{1,\}8" 2>/dev/null
if [ $? -eq 0 ]; then echo "Skipped"
else 
	svccfg -s svc:/network/dns/server setprop  tm_man_named/section = astring: 8 >/dev/null 2>&1
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

svcadm refresh svc:/network/dns/server:default

printf "%-60s" "Creating directories for configuration, DBs, logs, etc..."

if [ $servertype == "master" ]; then
	dbs="root base its mp pp misc qa nodb"
else
	dbs="root base its mp pp misc qa bl nodb"
fi

errors="no"
for i in /etc/named /ebay/bind-logs /var/named/db /var/named/tmp /var/named/run; do
	if [ ! -d $d ]; then errors="yes"; fi
done

if [ -d /var/named/db ]; then 
	cd /var/named/db
	for d in $(echo $dbs); do if [ ! -d $d ]; then errors="yes"; fi; done
else	
	errors="yes"
fi

if [ $errors == "no" ]; then
	echo "Skipped"
else
	errors="no"
	mkdir -p /etc/named /ebay/bind-logs /var/named/db /var/named/tmp /var/named/run 2>/dev/null
	if [ $? -ne 0 ]; then errors="yes"; fi
	for d in $(echo $dbs); do 
		mkdir -p /var/named/db/${d} 2>/dev/null
		if [ $? -ne 0 ]; then errors="yes"; fi
	done
	chown -R named:named /etc/named /var/named /ebay/bind-logs
	if [ $? -ne 0 ]; then errors="yes"; fi
	if [ $errors == "no" ] ;then echo "Success"; else echo "Failure"; fi
fi

printf "%-60s" "Modifying /.ssh/authorized_keys..."
/usr/xpg4/bin/grep -q '^ssh-dss AAAAB3NzaC1kc3MAAACBANXNZKyitH2i97lkYexvoVSYtrtYMQBGhrSUcnD6vw8Uam66VWW+FS7kQY/sBaAuJRnCg1bOjqudAIoiYrd7JbMNfNkvDUcoBvbARer6SA7wTkzDr8WECgiGYAPtom3rIy/ruNs1t7t3mWCLwrTJku+D6hAUOM723/4D3MtTnVYjAAAAFQC21yuxc40Ya9sa3Mz5LDMb35cFjQAAAIEAxnW+fyCfNeIGX43iRY9a3steGTjGfJFCIKdiC8QvBKEvo+sW4fbtQVLDZDTxevn/TKUQfa+BcQpLUeXayDBVTwbj1yQzijD0j+tApKI8987UDJ6OdP3P5pJDtrP8Ycj4pjtUdmiW/sVKx5wnCqzhZch2aFGrIt5spDOOriHLySQAAACACe9wJRuOLaIe9eCB9/mv+6zOElQBcpi3ihYpEcwOXAZWZco0AVt6FcMyldfLwlwAhLCeugZ1Q4al+WmtGyeWctRolc7/PFS37t+soXLVKZZqjSWxIlnjUGhmYkIQDjGQWGEVF6CcfiLBdsa1MEBmvvsc3TjFX0swUIy2ES27eok= root@sjcitdns01$' /.ssh/authorized_keys
if [ $? -eq 0 ]; then echo "Skipped"
else 
	echo -e 'ssh-dss AAAAB3NzaC1kc3MAAACBANXNZKyitH2i97lkYexvoVSYtrtYMQBGhrSUcnD6vw8Uam66VWW+FS7kQY/sBaAuJRnCg1bOjqudAIoiYrd7JbMNfNkvDUcoBvbARer6SA7wTkzDr8WECgiGYAPtom3rIy/ruNs1t7t3mWCLwrTJku+D6hAUOM723/4D3MtTnVYjAAAAFQC21yuxc40Ya9sa3Mz5LDMb35cFjQAAAIEAxnW+fyCfNeIGX43iRY9a3steGTjGfJFCIKdiC8QvBKEvo+sW4fbtQVLDZDTxevn/TKUQfa+BcQpLUeXayDBVTwbj1yQzijD0j+tApKI8987UDJ6OdP3P5pJDtrP8Ycj4pjtUdmiW/sVKx5wnCqzhZch2aFGrIt5spDOOriHLySQAAACACe9wJRuOLaIe9eCB9/mv+6zOElQBcpi3ihYpEcwOXAZWZco0AVt6FcMyldfLwlwAhLCeugZ1Q4al+WmtGyeWctRolc7/PFS37t+soXLVKZZqjSWxIlnjUGhmYkIQDjGQWGEVF6CcfiLBdsa1MEBmvvsc3TjFX0swUIy2ES27eok= root@sjcitdns01' >> /.ssh/authorized_keys
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
fi

if [ $servertype == "master" ]; then

#####################################################################
# set up a master 
#####################################################################

   printf "%-60s" "Creating /.ssh/id_dsa..."
   if [ -f /.ssh/id_dsa ]; then
	echo "Skipped"
   else
	cat > /.ssh/id_dsa <<DSAEOF
-----BEGIN DSA PRIVATE KEY-----
MIIBuwIBAAKBgQDVzWSsorR9ove5ZGHsb6FUmLa7WDEARoa0lHJw+r8PFGpuulVl
vhUu5EGP7AWgLiUZwoNWzo6rnQCKImK3eyWzDXzZLw1HKAb2wEXq+kgO8E5Mw6/F
hAoIhmAD7aJt6yMv67jbNbe7d5lgi8K0yZLvg+oQFDjO9t/+A9zLU51WIwIVALbX
K7FzjRhr2xrczPksMxvflwWNAoGBAMZ1vn8gnzXiBl+N4kWPWt7LXhk4xnyRQiCn
YgvELwShL6PrFuH27UFSw2Q08Xr5/0ylEH2vgXEKS1Hl2sgwVU8G49ckM4ow9I/r
QKSiPPfO1AyejnT9z+aSQ7az/GHI+KY7VHZolv7FSsecJwqs4WXIdmhRqyLebKQz
jq4hy8kkAoGACe9wJRuOLaIe9eCB9/mv+6zOElQBcpi3ihYpEcwOXAZWZco0AVt6
FcMyldfLwlwAhLCeugZ1Q4al+WmtGyeWctRolc7/PFS37t+soXLVKZZqjSWxIlnj
UGhmYkIQDjGQWGEVF6CcfiLBdsa1MEBmvvsc3TjFX0swUIy2ES27eokCFAIiLMk+
DjSgehPLVj2Aq5FGF+EG
-----END DSA PRIVATE KEY-----
DSAEOF
	chmod 600 /.ssh/id_dsa; echo Done
   fi

   printf "%-60s" "Creating /.ssh/id_dsa.pub..."
   if [ ! -f /.ssh/id_dsa.pub ]; then
	cat > /.ssh/id_dsa.pub <<DSAPUBEOF
ssh-dss AAAAB3NzaC1kc3MAAACBANXNZKyitH2i97lkYexvoVSYtrtYMQBGhrSUcnD6vw8Uam66VWW+FS7kQY/sBaAuJRnCg1bOjqudAIoiYrd7JbMNfNkvDUcoBvbARer6SA7wTkzDr8WECgiGYAPtom3rIy/ruNs1t7t3mWCLwrTJku+D6hAUOM723/4D3MtTnVYjAAAAFQC21yuxc40Ya9sa3Mz5LDMb35cFjQAAAIEAxnW+fyCfNeIGX43iRY9a3steGTjGfJFCIKdiC8QvBKEvo+sW4fbtQVLDZDTxevn/TKUQfa+BcQpLUeXayDBVTwbj1yQzijD0j+tApKI8987UDJ6OdP3P5pJDtrP8Ycj4pjtUdmiW/sVKx5wnCqzhZch2aFGrIt5spDOOriHLySQAAACACe9wJRuOLaIe9eCB9/mv+6zOElQBcpi3ihYpEcwOXAZWZco0AVt6FcMyldfLwlwAhLCeugZ1Q4al+WmtGyeWctRolc7/PFS37t+soXLVKZZqjSWxIlnjUGhmYkIQDjGQWGEVF6CcfiLBdsa1MEBmvvsc3TjFX0swUIy2ES27eok= root@sjcitdns01
DSAPUBEOF
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
   else 
	echo "Skipped"
   fi
	
   printf "%-60s" "Creating /.ssh/id_rsa..."
   if [ -f /.ssh/id_rsa ]; then
	echo "Skipped"
   else
	cat > /.ssh/id_rsa <<RSAEOF
-----BEGIN RSA PRIVATE KEY-----
MIICWgIBAAKBgQCvRSvlYGkRlXLtUw4pSO5eiqhir8BidOCQfLHcS3QlzMQHp3Ke
xOMLXy1wkC5bi0bc+avC+GKwlKKOfumP3REoXZ5me6AukNfQUqV2ZeN28G8ieCkk
CzH5diwKAs/BHON6qs7xz+KAg3LgEogl9+sYSONirxu3/YdQR9hrZnCcNQIBIwKB
gFAfnwnFrF/PSnsep2NUijnY/ITioRcQ26/D+YlHEIZO+ocn+eIuHqYc4ZKLDeC0
sq4o/g/8hOMCHm0G0SvSxgMRVdGgSWE0AzwxGnlDyvIor/jqew7DFtwgjVB2IcHi
3MOROYSnaTtLnuDK7EqIVbIpq2XNLiHo/rJEUQCbesuLAkEA1yMsRs74UF6xR23B
7xyWCyV3+Ssg7JGeBv3ApPAouz4XmBFxbN+cLf7TEc0Ei9raHDoEi82/NGnp5FeR
dZlo0QJBANCPf6YwsZ6yC1/NyzJ67yxIuf4Q0tPeWef5KVt1wEFid0UPrjTMsqAI
gUTWPmHUyHGCb3J5DptwQG4PqJy6liUCQE/ofijtyfH3SSkoxGAgj4B7oZcQBOon
dTXL9xiw+S+auE5s4PyNkcfw70/BLZMIJSBtUiVMa5cgBmrBcIrD87sCQQCJDdeK
d8UtxXUwVAkvzSDT9UcGCw4zdNv+1u9Kuxfwc+f6LuAxU1DPkI92YOcqWKD6IoPA
QOxXhEeYyHYd2bMfAkB3FkN5esSVmNYH/ZfuuJYzbSRtQPW+NLiEhHx103RNxY3+
fc1JPoDAeV5ooUJ2a+26SoXEJ/zq/Yq+rVQvnYjV
-----END RSA PRIVATE KEY-----
RSAEOF
	chmod 600 /.ssh/id_rsa; echo Done
   fi

   printf "%-60s" "Creating /.ssh/id_rsa.pub..."
   if [ ! -f /.ssh/id_rsa.pub ]; then
	cat > /.ssh/id_rsa.pub <<RSAPUBEOF
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAr0Ur5WBpEZVy7VMOKUjuXoqoYq/AYnTgkHyx3Et0JczEB6dynsTjC18tcJAuW4tG3PmrwvhisJSijn7pj90RKF2eZnugLpDX0FKldmXjdvBvIngpJAsx+XYsCgLPwRzjeqrO8c/igINy4BKIJffrGEjjYq8bt/2HUEfYa2ZwnDU= root@sjcitdns01
RSAPUBEOF
	if [ $? -eq 0 ] ;then echo "Success"; else echo "Failure"; fi
   else 
	echo "Skipped"
   fi

   echo -e "
Follow-up Actions:

. Copy configuration, master zones & tools from primary master DNS server:
# cd /etc/named; tar cf - . | ssh $(hostname).vip.its.ebay.com \"cd /etc/named; tar xf -\"
# cd /var/named/db; tar cEf - root its | ssh $(hostname).vip.its.ebay.com \"cd /var/named/db; tar xf -\""
else 

#####################################################################
# set up a slave 
#####################################################################

	if [ -f /.ssh/id_rsa ]; then rm /.ssh/id_rsa; fi
	if [ -f /.ssh/id_dsa ]; then rm /.ssh/id_dsa; fi
	echo -e "
Follow-up Actions:

. Copy configuration from a slave DNS server:
# cd /etc/named; tar cf - . | ssh $(hostname).vip.its.ebay.com \"cd /etc/named; tar xf -\"

. Copy master zones, tools from primary master DNS server:
# cd /var/named/db; tar cEf - root bl | ssh $(hostname).vip.its.ebay.com \"cd /var/named/db; tar xf -\""
fi

echo -e "# cd /usr/local; tar cf - sbin | ssh $(cat /usr/bin/nodename) \"cd /usr/local; tar xf -\"

. Redefine ACL on /etc/named/named.conf if needed.

. Build BIND binaries with BIND source codes, e.g.,
# export BINDVER="9.9.4-P1"
# gzcat bind-\${BINDVER}.tar.gz  | tar xf -
# cd bind-\${BINDVER}
# ./configure  -sysconfdir=/etc/named  -prefix=/opt/bind-\${BINDVER} -disable-ipv6  -enable-threads -with-openssl=no
# make
# make install
# ln -s /opt/bind-\${BINDVER} /opt/bind
"
if [ ! -x /opt/bind/bin/nslookup ]; then
	echo -e ". Copy /opt/bind/bin to global zone: 
$(cat /usr/bin/nodename)# zlogin z_$(hostname) \"cd /opt; tar cf - bind/bin\" | (cd /opt; tar xf -)
"
fi

